home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The X-Philes (2nd Revision)
/
The X-Philes Number 1 (1995).iso
/
xphiles
/
hp48_1
/
schd.bac
< prev
next >
Wrap
Text File
|
1995-03-23
|
8KB
|
167 lines
Article 1517 of comp.sys.handhelds:
From: lishka@uwslh.slh.wisc.edu (Chris Lishka (a.k.a. Chri) )
Subject: HP48sx program: overnight processing and backups
Message-ID: <1990Mar14.192526.18389@uwslh.slh.wisc.edu>
Date: 14 Mar 90 19:25:26 GMT
Reply-To: lishka@uwslh.UUCP (Chris Lishka (a.k.a. Chri) )
Organization: Wisconsin State Laboratory of Hygiene
Lines: 155
After reading through the manuals, I wanted to try out the hp48sx programmable
alarm facility and ports. One thing I wanted to do was save a backup copy of
the system in case I accidentally blow something away (or overwrite it). This
was a perfect job for an overnight programmable alarm! So I sat down and wrote
these programs as a general way to run overnight processing.
This set of programs sets up a job to run at 3:00am, when I am the least likely
to be programming on it. The calculator "wakes up," performs a backup and
keypack, and then shuts off again. The alarm is rescheduled automatically to
run the next night. I thought others might like to use this technique to run
their own stuff, so I am posting these programs.
There are five programs included in this set. The first three implement the
overnight processing functions:
* SCHEDULE will set up the alarm. It should only be run if no overnight
processing is being done routinely. I have not tested what happens if
you try to schedule two or more alarms at the same time.
* JOB contains the job to be run overnight. This program is used to call
other programs (which do the real processing), turn the machine off, and
print a report (when the machine is turned on again) to let the user know
the overnight processing ran.
* REPORT prints a report stating when the overnight processing was run.
The other two programs perform specific functions in the overnight processing:
* BACKUP creates an archive of all memory in the computer and stores it in
PORT0. Note that using a straight archive like this effectively reduces
your usable memory by 50% (half for you to use, half for the archive).
Since memory is not a big concern to me, I have kept this simple. You
will likely want to replace the archive with some smarter scheme that
uses less memory (possibly something on the order of Bob Peraino's
archive program for the hp28). Also note that NO memory checking is done
to see if enough exists for the new archive. I leave this as an exercise
for the reader.
* KEYPACK reclaims memory used by old programmable (i.e. USER) key
definitions. The user's manual mentions that this should be done
periodically, and early in the morning seems like the best time to do it.
Note that this should be run before the BACKUP command to free useless
memory before it is archived.
Only the JOB program takes an argument (the number returned by the alarm).
None of the programs return an values. Accompanying each program name is the
checksum and byte-count as computed by the BYTES command.
I have all of this set up in one directory (path = {HOME root LIB NIGHT}). You
will most likely have a different directory structure than mine, and therefore
you will need to edit the programs to match your system. Also, make sure the
repeat interval is correct. I have know idea what a super-short repeat
interval (i.e. less than one second) will do, nor do I really want to find out.
I hope you find this helpful. I really like the programmable alarm feature,
which is much like the Unix CRON facility, except that it is much easier to
start hp48sx alarms than edit a crontab file!
.oO Chris Oo.
Note: I don't yet have a serial cable, and my manuals are at home, so I have
*not* used the HP back-slash sequences for the non-ascii characters. Here are
the substitutions I used:
<< = Program-begin
>> = Program-end
-> = Right-pointing-arrow
# SCHEDULE sets an alarm to occur at 3am in the morning, with a reschedule/
# repeat interval of one day. The contents of the variable JOB (in the
# current path) are used as the program to be executed.
SCHEDULE [ #18746d, 74.5 ]
<<
{ } # * Construct a list of arguments for STOALARM
DATE 1 DATE+ + # * Make sure it runs *tomorrow* morning. This
# will need to be changed if you run it
# *before* midnight.
3 + # * Run the job at 3am.
'JOB' RCL + # * Store the program to be run. I use the
# contents of variable JOB in the current
# directory.
707788800 + # * Repeat interval (1 day)
# = 8192ticks/sec * 60sec * 60min * 24hr
STOALARM # * Use the constructed list to set the alarm.
>> 'SCHEDULE' STO
# JOB contains the program to be run every night. It is only accessed by
# SCHEDULE. Note that schedule *could* just hand off the name 'JOB' to the
# alarm, but giving the actual program (i.e. contents of JOB) is safer
# because the alarm does not have to change to the directory where JOB is
# located (although currently it does anyway in order to run the KEYPACK
# and BACKUP programs).
JOB [ #34504d, 87 ]
<<
DROP # * Drop the value returned by the alarm.
HOME root LIB NIGHT # * Switch to the directory which contains the
# programs to run at night. You will need
# need to change this to suit your system.
KEYPACK # * Run the program to free up USER memory.
BACKUP # * Run the nightly backup script.
OFF # * Put the hp48 back to sleep.
REPORT # * Print a report next time the calculator
# is turned on.
HOME root # * Change back to the "root" directory. Again,
# you will need to change this to your
# match the directories of your system.
>> 'JOB' STO
# REPORT prints a message indicating that the overnight processing was run.
# If it is run right after the OFF command (in JOB), the message will be
# displayed the next the calculator is turned on.
REPORT [ #55113d, 93 ]
<<
CLLCD # * Clear the screen.
"Night processing:" 4 DISP # * Display the message
DATE TIME TSTR 5 DISP # * Show the date and time the overnight
# processing ran.
"Memory: " MEM ->STR + #
6 DISP # * Also display the remaining memory
2 FREEZE # * Keep the information around
>> 'REPORT' STO
# BACKUP creates an archive of the current memory in a file in PORT0. The
# time the backup was created is also stored. If you have extra RAM, you may
# want to change this to save in a different port (swap :1: or :2: for :0:).
# Also, if you don't want to save the entire memory contents, you can
# substitute some other command sequence for the ARCHIVE command.
BACKUP [ #52737d, 92 ]
<<
:0:BACKUP PURGE # * Remove the previous backup and the record
:0:BTIME PURGE # of when it was created.
:0:BACKUP ARCHIVE # * Create a new archive of the current memory
DATE TIME TSTR # * Grab the current date and time.
:0:BTIME STO # * Save the time that the backup was run for
# future reference.
>> 'BACKUP' STO
# KEYPACK packs the programmable key definitions. The user's manuals (in the
# customization chapter, I believe) states that this should be done from time
# to time to keep memory from chewed up with old key definitions. The code
# in this program is straight out of the user's manaul example.
KEYPACK [ #64094d, 31.5 ]
<<
RCLKEYS 0 DELKEYS STOKEYS # * Straight from the user's manuals!
>> 'KEYPACK' STO
--
Christopher Lishka 608-262-4485 "Somebody said to me, `But the Beatles were
Wisconsin State Lab. of Hygiene antimaterialistic.' That's a huge myth. John
lishka@uwslh.slh.wisc.edu and I literally used to sit down and say `Now,
uunet!uwvax!uwslh!lishka let's write a swimming pool'."--Paul McCartney